<template>
    <div class="asset-group-setting">
        <div class="move-box">
            <RiskLeftModule
                v-model="inputValueLeft"
                @on-handleNode="clickNode"
                :placeholders="ltitleName"
                :treeData="treeData"
                :leftHeight="leftHgt"
                :currentKey="2"
                :defaultExpandedKeys="defaultExpandedKeys"
            >
                <template slot="ltitle">资产单元组信息</template>
            </RiskLeftModule>
            <!-- 资产单元组信息 -->
            <template v-if="cutInfo === '本地' || cutInfo === '外部'">
                <RiskRightModule v-model="inputValueRight" :rightPlace="rtitleName" :rightHeight="leftHgt" @on-keyup="selectGroup" key="1">
                    <p slot="rtitle">资产单元组信息</p>
                    <span slot="button" class="dict-r-slot">
                        <el-button type="primary" size="mini" @click="selectGroup">查询</el-button>
                    </span>
                    <span slot="button" class="dict-r-slot">
                        <el-button type="primary" size="mini" @click="handleBtnG('add')" v-show="cutInfo === '本地'">新增</el-button>
                    </span>
                    <span slot="button" class="dict-r-slot">
                        <el-button type="danger" size="mini" @click="handleBtnG('delete')" v-show="cutInfo === '本地'">删除</el-button>
                    </span>
                    <slot>
                        <div style="height:calc( 100% - 135px)">
                            <RiskTable :msg="groupMsg" @handleBtn="handleGroupRow" ref="group" @handleSort="handleSort"></RiskTable>
                        </div>
                        <RiskPagination :paging="groupPage" @page-change="pageRet"></RiskPagination>
                    </slot>
                </RiskRightModule>

                <yh-dialog :title="assetGroupDialog.title" :visible.sync="assetGroupDialog.visible" width="400px" drag>
                    <el-form label-width="120px" size="mini">
                        <el-form-item label="单元组编号">
                            <el-input placeholder="自动生成" style="width: 220px" disabled v-model="groupData.assetGroupCode"></el-input>
                        </el-form-item>
                        <el-form-item label="单元组名称" required>
                            <el-input style="width: 220px" v-model="groupData.assetGroupName" :disabled="assetGroupDialog.action == 0"></el-input>
                        </el-form-item>
                        <el-form-item label="创建者">
                            <el-input style="width: 220px" v-model="groupData.operatorName" disabled></el-input>
                        </el-form-item>
                        <el-form-item label="创建日期">
                            <el-input style="width: 220px" v-model="groupData.createDate" disabled></el-input>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="cancel('AU')"> 取 消 </el-button>
                        <el-button size="mini" type="primary" @click="confirm('AU')" v-show="assetGroupDialog.action != 0">
                            确 定
                        </el-button>
                    </div>
                </yh-dialog>
            </template>

            <!-- 资产单元信息 -->
            <template v-else>
                <RiskRightModule v-model="inputValueRight" rightPlace="资产单元编号/名称" :rightHeight="leftHgt" key="2">
                    <p slot="rtitle">资产单元组信息</p>
                    <span slot="button" class="dict-r-slot">
                        <el-button type="primary" size="mini" @click="selectDetail">查询</el-button>
                    </span>
                    <span slot="button" class="dict-r-slot">
                        <el-button type="primary" size="mini" @click="handleDetailBtn('edit')" v-show="currentData.sourceType == '1'">编辑</el-button>
                    </span>
                    <span slot="button" class="dict-r-slot">
                        <el-button type="danger" size="mini" @click="handleDetailBtn('delete')" v-show="currentData.sourceType == '1'"
                            >删除</el-button
                        >
                    </span>
                    <slot>
                        <div style="height:calc(100% - 135px)">
                            <RiskTable :msg="detailMsg" @handleBtn="handleDetailRow" ref="detail" @handleSort="handleSort1"></RiskTable>
                        </div>
                        <RiskPagination :paging="detailPage" @page-change="detailPageChange"></RiskPagination>
                    </slot>
                </RiskRightModule>
                <!-- 编辑 -->
                <yh-dialog title="编辑资产单元组内基本信息" :visible.sync="editDetailDialog.visible" class="editDialog" width="800px" drag>
                    <div style="height: fit-content">
                        <RiskTrantable
                            leftPlaceholder="编号/名称"
                            rightPlaceholder="编号/名称"
                            :leftColumns="tranColumns"
                            :rightColumns="tranColumns"
                            :leftTableData="leftTranData"
                            :rightTableData="rightTranData"
                            :leftSearchNames="['assetCode', 'assetName']"
                            indexKey="assetCode"
                            ref="tranTable"
                            sort="assetName"
                            :key="transKey"
                        />
                    </div>
                    <div slot="footer" class="dialog-footer">
                        <el-button size="mini" @click="cancelBtnD('edit')"> 取 消 </el-button>
                        <el-button size="mini" type="primary" @click="confirmD('edit')">确 定 </el-button>
                    </div>
                </yh-dialog>
            </template>
            <!-- 删除 -->
            <yh-dialog drag :title="deleteDialog.title" :visible.sync="deleteDialog.visible" width="500px" :close-on-click-modal="false">
                <div>
                    <p>{{ delPendingData.join(',') }}</p>
                </div>
                <div slot="footer" class="dialog-footer">
                    <el-button size="mini" @click="cancel('delete')"> 取 消 </el-button>
                    <el-button size="mini" type="primary" @click="confirm('delete')">确 定 </el-button>
                </div>
            </yh-dialog>

            <!-- 查看资产单元 -->
            <yh-dialog :title="assetDetailDialog.title" :visible.sync="assetDetailDialog.visible" width="400px" drag>
                <el-form label-width="120px" size="mini">
                    <el-form-item label="资产单元编号">
                        <el-input placeholder="自动生成" style="width: 220px" v-model="detailRow.assetCode" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="资产单元名称">
                        <el-input style="width: 220px" v-model="detailRow.assetName" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="数据来源类型">
                        <el-select v-model="detailRow.sourceType" size="mini" disabled style="width: 220px">
                            <el-option v-for="(value, key) in SourceType" :key="key" :label="value" :value="key"> </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="成立日期">
                        <el-input style="width: 220px" v-model="detailRow.openDate" disabled></el-input>
                    </el-form-item>
                </el-form>
                <div slot="footer" class="dialog-footer">
                    <el-button size="mini" @click="assetDetailDialog.visible = false"> 取 消 </el-button>
                </div>
            </yh-dialog>
        </div>
    </div>
</template>
<script lang="ts">
import RiskIconButton from '@/common/components/risk-icon-button.vue';
import RiskLeftModule from '@/common/components/risk-left-module.vue';
import RiskRightModule from '@/common/components/risk-right-module.vue';
import RiskTrantable from '@/common/components/risk-trantable.vue';
import { Component, Vue } from 'vue-property-decorator';
import RiskPagination from '@/common/components/risk-pagination.vue';
import {
    assetGroupDeleteByCodes,
    assetGroupInsert,
    assetGroupInsertByCodes,
    assetGroupList,
    assetGroupUpdate,
    assetList,
    assetListByCode,
} from './asset-group-setting/index';
import RiskTable from '@/common/components/risk-table.vue';
import { getCurrentPageData } from '@/utils/tools';
import { DialogVO } from '@yhfin/biz';
import XEUtils from 'xe-utils';
import { getUser } from '@/utils/user-util';
import Dict from './dict/index';
import DictionConstUtil from '@/utils/diction-const-util';

export interface pages {
    total?: number;
    pageSize?: number;
    currentPage?: number;
}

@Component({
    name: 'AssetGroupSetting',
    components: {
        RiskLeftModule,
        RiskRightModule,
        RiskIconButton,
        RiskTrantable,
        RiskPagination,
        RiskTable,
    },
})
export default class AssetGroupSetting extends Vue {
    SourceType = DictionConstUtil.SourceType;
    private inputValueLeft: string = '';
    private ltitleName: string = '编号/名称';
    private leftHgt: string = '100vh';
    private inputValueRight: string = '';
    private rtitleName: string = '编号/名称';
    private right2Place: string = '编号/名称';
    private defaultExpandedKeys: any[] = [2]; // 默认展开
    private selectSourceType: string = ''; // 来源类型(外部)
    tableDataList: any[] = []; // 展示数据
    private delPendingData: any[] = []; // 待删除数据
    deleteDialog: DialogVO = new DialogVO();
    assetGroupDialog: DialogVO = new DialogVO();
    editDetailDialog: DialogVO = new DialogVO();
    assetDetailDialog: DialogVO = new DialogVO();
    detailRow: any = {}; // 点击明细行
    tableDataLocal: any[] = [];
    tableDataOutside: any[] = [];
    tableDataSearched: any[] = []; // 筛选后的值
    cutInfo: string = '外部';
    fundTypesPojo: any = {};
    private leftTranData: any[] = [];
    private rightTranData: any[] = [];

    transKey: number = -1;
    private tranColumns: any[] = [
        {
            label: '编号',
            prop: 'assetCode',
            width: 80,
        },
        {
            label: '名称',
            prop: 'assetName',
            width: 165,
        },
    ];
    private groupData: any = {
        assetGroupCode: '自动生成',
        assetGroupName: '',
        sourceType: '1',
        operatorName: getUser().userNickName,
        createDate: XEUtils.toDateString(new Date(), 'yyyyMMdd'),
    };
    // 树形结构
    private treeData: any = [
        {
            label: '本地',
            id: 1,
            children: [],
        },
        {
            label: '外部',
            id: 2,
            children: [],
        },
    ];

    private groupPage: pages = {
        currentPage: 1,
        pageSize: 50,
        total: 0,
    };

    private detailPage: pages = {
        currentPage: 1,
        pageSize: 50,
        total: 0,
    };

    groupMsg = {
        returnData: {},
        dataKey: 'list',
        title: [
            { name: '单元组编号', val: 'assetGroupCode' },
            { name: '单元组名称', val: 'assetGroupName' },
            { name: '数据来源类型', val: 'sourceType', type: 'status', statusKV: new Dict().SourceType, minWidth: 100 },
            { name: '创建者', val: 'operatorName' },
            { name: '创建日期', val: 'createDate', type: 'dates', sortable: true, width: '180px', },
            {
                name: '操作',
                type: 'btn',
                btns: [
                    { title: '查看', type: 'primary', icon: 'el-icon-view' },
                    { title: '编辑', type: 'primary', icon: 'el-icon-edit', isDisabled: row => row.sourceType != '1' },
                    { title: '删除', type: 'danger', icon: 'el-icon-delete', isDisabled: row => row.sourceType != '1' },
                ],
                width: '140px',
            },
        ],
        checked: { on: true, option: false },
        hidePage: true,
    };

    detailMsg = {
        returnData: {},
        dataKey: 'list',
        title: [],
        checked: { on: true, option: false },
        hidePage: true,
        // height: '100%',
    };

    detailColomns = [
        { name: '产品代码', val: 'fundCode' },
        { name: '产品名称', val: 'fundName' },
        { name: '产品类型', val: 'fundType', type: 'status', statusKV: this.fundTypesPojo },
        { name: '资产单元编号', val: 'assetCode' },
        { name: '资产单元名称', val: 'assetName' },
        { name: '数据来源类型', val: 'sourceType', type: 'status', statusKV: DictionConstUtil.SourceType },
        { name: '成立日期', val: 'openDate', type: 'date', sortable: true },
        {
            name: '操作',
            type: 'btn',
            btns: [{ title: '查看', type: 'primary', icon: 'el-icon-view' }],
            width: '80px',
        },
    ];

    async mounted() {
        this.getInfo();

        await this.getDict();
        let index = this.detailColomns.findIndex(item => item.val == 'fundType');
        this.detailColomns[index] = { name: '产品类型', val: 'fundType', type: 'status', statusKV: this.fundTypesPojo };
        this.$set(this.detailMsg, 'title', this.detailColomns);
    }

    // 字典值
    async getDict() {
        return this.$axios.get('/dict/list/code/Y_000002').then((res: any) => {
            this.fundTypesPojo = DictionConstUtil.ListToPojo(res);
        });
    }
    // 获取信息
    getInfo() {
        assetGroupList()
            .then((res: any) => {
                var local = [];
                var outside = [];
                for (let item of res) {
                    if (item.sourceType === '1') {
                        let datas = item.assetGroupCode + '-' + item.assetGroupName;
                        local.push(Object.assign(item, { label: datas, id: item.assetGroupCode }));
                    } else {
                        let datas = item.assetGroupCode + '-' + item.assetGroupName;
                        outside.push(Object.assign(item, { label: datas, id: item.assetGroupCode }));
                    }
                }
                this.treeData[0].children = local;
                this.treeData[1].children = outside;

                this.tableDataLocal = local;
                this.tableDataOutside = outside;
                this.getTableData();
            })
            .catch(err => {
                console.log(err, 'assetGroupList');
            });
    }

    /** ********************* 组合处理START******************************* */
    // 按钮点击
    handleBtnG(type: string) {
        if (type == 'add') {
            this.groupData = {
                assetGroupCode: '自动生成',
                assetGroupName: '',
                sourceType: '1',
                operatorName: getUser().userNickName,
                createDate: XEUtils.toDateString(new Date(), 'yyyyMMdd'),
            };
            this.assetGroupDialog = this.assetGroupDialog.getAddDialog('新增资产单元组');
        } else if (type == 'delete') {
            const hasSelectedData = ((this.$refs.group as any).$refs.riskTable as any).getCheckboxRecords();
            if (hasSelectedData.length < 1) {
                this.yh_message_warn('未选择删除项');
            } else {
                this.delPendingData = hasSelectedData.map(item => item.assetGroupCode);
                this.deleteDialog = this.deleteDialog.getDeleteDialog('确定删除资产单元组？');
            }
        }
    }

    // 点击行
    handleGroupRow({ type, row }) {
        let title = type;
        if (title == '查看') {
            this.assetGroupDialog = this.assetGroupDialog.getSeeDialog('查看单元组');
            this.groupData = JSON.parse(JSON.stringify(row));
        } else if (title == '编辑') {
            this.assetGroupDialog = this.assetGroupDialog.getUpdateDialog('编辑单元组');
            this.groupData = JSON.parse(JSON.stringify(row));
        } else if (title == '删除') {
            this.delPendingData = [row.assetGroupCode];
            this.deleteDialog = this.deleteDialog.getDeleteDialog('确定删除资产单元组？');
        }
    }

    // 取消
    cancel(type: string) {
        if (type == 'AU') {
            this.assetGroupDialog.visible = false;
        } else if (type == 'delete') {
            this.deleteDialog.visible = false;
        }
    }

    // 确认
    confirm(type: string) {
        if (type == 'AU') {
            let value = this.groupData.assetGroupName.trim();
            if (!value) {
                this.yh_message_error('单元组名称不能为空');
                return;
            }
            if (this.assetGroupDialog.action == 1) {
                // 新增
                assetGroupInsert(this.groupData)
                    .then((res: any) => {
                        this.getInfo();
                        this.yh_message_success('新增成功');
                        this.assetGroupDialog.visible = false;
                    })
                    .catch(err => {
                        console.log(err, 'assetGroupInsert');
                    });
            } else if (this.assetGroupDialog.action == 2) {
                // 修改
                assetGroupUpdate(this.groupData)
                    .then((res: any) => {
                        this.getInfo();
                        this.yh_message_success('修改成功');
                        this.assetGroupDialog.visible = false;
                    })
                    .catch(err => {
                        console.log(err, 'assetGroupInsert');
                    });
            }
        } else if (type == 'delete') {
            if (this.cutInfo == '本地') {
                assetGroupDeleteByCodes(this.delPendingData)
                    .then((res: any) => {
                        this.yh_message_success('删除成功');
                        this.getInfo();
                        this.deleteDialog.visible = false;
                    })
                    .catch(err => {
                        console.log(err, 'assetGroupDeleteByCodes');
                    });
            } else {
                // 明细删除
                // todo
                let codeList = [];
                this.detailTableDataAll.map(item => {
                    if (this.delPendingData.includes(item.assetCode)) {
                    } else {
                        codeList.push(item.assetCode);
                    }
                });
                assetGroupInsertByCodes(this.currentData.id, codeList)
                    .then((res: any) => {
                        this.getDetailData(this.currentData.id);
                        this.yh_message_success('删除成功');
                        this.deleteDialog.visible = false;
                    })
                    .catch(err => {
                        console.log(err, 'assetGroupInsertByCodes删除');
                    });
            }
        }
    }

    // 分页
    private pageRet(): void {
        let data = [];
        if (this.inputValueRight) {
            this.groupPage.total = this.tableDataSearched.length;
            data = getCurrentPageData(this.tableDataSearched, this.groupPage.currentPage, this.groupPage.pageSize);
        } else {
            this.groupPage.total = this.tableDataList.length;
            data = getCurrentPageData(this.tableDataList, this.groupPage.currentPage, this.groupPage.pageSize);
        }
        this.$set(this.groupMsg.returnData, 'list', data);
    }

    // 右侧查询
    private selectGroup(): void {
        this.tableDataSearched = this.handleFilter(this.tableDataList, this.inputValueRight, 'assetGroupCode', 'assetGroupName');
        this.groupPage.currentPage = 1;
        this.pageRet();
    }

    // 资产单元组筛选数据
    private handleFilter(dataSource: any, param: any, code: string, name: string): any {
        if (!param || !dataSource) {
            return dataSource;
        } else {
            return dataSource.filter((item: any) => {
                return (
                    (item[name] || '').toUpperCase().includes(param.toUpperCase()) || (item[code] || '').toUpperCase().includes(param.toUpperCase())
                );
            });
        }
    }

    /** ********************* 组合处理END ******************************* */

    /** ********************* 单个组处理START******************************* */
    detailTableDataSearched: any[] = []; // 单个单元组(筛选)
    detailTableDataAll: any[] = []; // 单个单元组所有数据

    // 分页(前端分页)
    private detailPageChange(): void {
        let data = [];
        if (this.inputValueRight) {
            this.detailPage.total = this.detailTableDataSearched.length;
            data = getCurrentPageData(this.detailTableDataSearched, this.detailPage.currentPage, this.detailPage.pageSize);
        } else {
            this.detailPage.total = this.detailTableDataAll.length;
            data = getCurrentPageData(this.detailTableDataAll, this.detailPage.currentPage, this.detailPage.pageSize);
        }
        this.$set(this.detailMsg.returnData, 'list', data);
    }

    // 单个产品组
    getDetailData(code: string) {
        assetListByCode(code).then((res: any) => {
            this.detailTableDataAll = res;
            this.selectDetail();
        });
    }

    // 点击行
    handleDetailRow({ type, row }) {
        let title = type;
        if (title == '查看') {
            this.assetDetailDialog = this.assetDetailDialog.getSeeDialog('查看资产单元');
            this.detailRow = JSON.parse(JSON.stringify(row));
        }
    }

    // 查询
    selectDetail() {
        this.detailTableDataSearched = this.handleFilter(this.detailTableDataAll, this.inputValueRight, 'assetCode', 'assetName');
        this.detailPage.currentPage = 1;
        this.detailPageChange();
    }

    // 明细编辑
    async handleDetailBtn(type: string) {
        if (type == 'edit') {
            this.rightTranData = this.detailTableDataAll;
            const assetCodes = XEUtils.map(this.detailTableDataAll, item => item.assetCode);
            this.editDetailDialog.visible = true;
            let value = await new Promise((resolve, reject) => {
                assetList()
                    .then((res: any) => {
                        let needData = res;
                        let retData = [];
                        for (let i = 0; i < needData.length; i++) {
                            if (!assetCodes.includes(needData[i].assetCode)) {
                                needData[i].id = needData[i].assetCode;
                                retData.push(needData[i]);
                            }
                        }
                        this.leftTranData = retData;
                        resolve(retData);
                    })
                    .catch((err: any) => {
                        reject(err);
                    });
            });
        } else if (type == 'delete') {
            const hasSelectedData = ((this.$refs.detail as any).$refs.riskTable as any).getCheckboxRecords();
            if (hasSelectedData.length < 1) {
                this.yh_message_warn('未选择删除项!');
            } else {
                this.delPendingData = hasSelectedData.map(item => item.assetCode);
                this.deleteDialog = this.deleteDialog.getDeleteDialog('确认删除资产单元组下资产单元？');
            }
        }
    }

    // 明细取消
    cancelBtnD(type: string) {
        if (type == 'edit') {
            this.editDetailDialog.visible = false;
            setTimeout(() => {
                this.transKey++;
            }, 500);
        } else if (type == 'delete') {
            this.deleteDialog.visible = false;
        }
    }

    // 明细点击
    confirmD(type: string) {
        if (type == 'edit') {
            let codeList = [];
            const rightData = (this.$refs.tranTable as any).getRightAllData();
            rightData.map((item: any) => {
                codeList.push(item.assetCode);
            });
            assetGroupInsertByCodes(this.currentData.id, codeList)
                .then((res: any) => {
                    this.getDetailData(this.currentData.id);
                    this.editDetailDialog.visible = false;
                    this.yh_message_success('保存成功');
                })
                .catch(err => {
                    console.log(err, 'assetGroupInsertByCodes');
                });
        }
    }
    /** ********************* 单个组处理END ******************************* */
    currentData: any = {};
    // 左边栏选择节点
    private clickNode(data: any): void {
        this.inputValueRight = '';
        this.cutInfo = data.label;
        this.currentData = data;
        console.log(data, 'dataF');

        this.getTableData();
    }

    // 节点数据
    private getTableData(): void {
        if (this.cutInfo == '本地') {
            this.tableDataList = this.tableDataLocal;
            this.selectGroup();
        } else if (this.cutInfo == '外部') {
            this.tableDataList = this.tableDataOutside;
            this.selectGroup();
        } else {
            this.getDetailData(this.currentData.id);
        }
    }
    private handleSort(property, order) {
        let data = [];
        this.groupPage.currentPage = 1;
        if (property == 'createDate' && order == 'asc') {
            if (this.inputValueRight) {
                this.tableDataSearched.sort(this.dateData(property, true))
                data = getCurrentPageData(this.tableDataSearched, this.groupPage.currentPage, this.groupPage.pageSize);
                this.$set(this.groupMsg.returnData, 'list', data);
            } else {
                this.tableDataList.sort(this.dateData(property, true))
                data = getCurrentPageData(this.tableDataList, this.groupPage.currentPage, this.groupPage.pageSize);
                this.$set(this.groupMsg.returnData, 'list', data);
            }
        } else if (property == 'createDate' && (order == 'desc' || order == null)) {
            if (this.inputValueRight) {
                this.tableDataSearched.sort(this.dateData(property, true)).reverse()
                data = getCurrentPageData(this.tableDataSearched, this.groupPage.currentPage, this.groupPage.pageSize);
                this.$set(this.groupMsg.returnData, 'list', data);
            } else {
                this.tableDataList.sort(this.dateData(property, true)).reverse()
                data = getCurrentPageData(this.tableDataList, this.groupPage.currentPage, this.groupPage.pageSize);
                this.$set(this.groupMsg.returnData, 'list', data);
            }
        }
    }
    private handleSort1(property, order) {
        let data = [];
        this.groupPage.currentPage = 1;
        if (property == 'openDate' && order == 'asc') {
            if (this.inputValueRight) {
                this.detailTableDataSearched.sort(this.dateData(property, true))
                data = getCurrentPageData(this.detailTableDataSearched, this.detailPage.currentPage, this.detailPage.pageSize);
                this.$set(this.detailMsg.returnData, 'list', data);
            } else {
                this.detailTableDataAll.sort(this.dateData(property, true))
                data = getCurrentPageData(this.detailTableDataAll, this.detailPage.currentPage, this.detailPage.pageSize);
                this.$set(this.detailMsg.returnData, 'list', data);
            }
        } else if (property == 'openDate' && (order == 'desc' || order == null)) {
            if (this.inputValueRight) {
                this.detailTableDataSearched.sort(this.dateData(property, true)).reverse()
                data = getCurrentPageData(this.detailTableDataSearched, this.detailPage.currentPage, this.detailPage.pageSize);
                this.$set(this.detailMsg.returnData, 'list', data);
            } else {
                this.detailTableDataAll.sort(this.dateData(property, true)).reverse()
                data = getCurrentPageData(this.detailTableDataAll, this.detailPage.currentPage, this.detailPage.pageSize);
                this.$set(this.detailMsg.returnData, 'list', data);
            }
        }
    }
    dateData(property, bol) {
        return function(a, b) {
            var value1 = a[property];
            var value2 = b[property];
            if (bol) {
            // 升序
                return Date.parse(value1) - Date.parse(value2);
            } else {
            // 降序
                return Date.parse(value2) - Date.parse(value1)
            }
        }
    }
}
</script>
<style lang="scss" scoped>
.asset-group-setting {
    position: relative;
    height: 100%;
    .selectStyle {
        width: 160px;
        margin-right: 10px;
    }
    .dict-r-slot {
        margin-left: 10px;
    }

    & /deep/ .el-dialog .el-dialog__body {
        max-height: 100vh;
    }
}

/deep/ .editDialog .el-dialog .el-dialog__body {
    height: 460px;
}
/deep/ .el-table--border::after,
.el-table--group::after {
    width: 0 !important;
    height: 0 !important;
}
/deep/ .el-table--border th:first-child .cell {
    padding-left: 6px;
}
/deep/ .vxe-table {
    .vxe-table--header {
        width: 10px !important;
    }
    .vxe-body--column .vxe-cell {
        height: 27px !important;
        line-height: 27px !important;
    }
}
// 必填项
/deep/ .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:after {
    color: red !important;
}
</style>
